﻿<!-- 实训管理--实训管理首页 -->
<template>



    <div>

        <!-- 添加按钮 -->
        <div class="btn-add">
        </div>
        <!-- 按条件选择 -->

        <el-row :gutter="20" style="height: 100px; margin: 15px;">
            <el-col :xs="6" :sm="6" class="mt10">
                <div>
                    <el-card shadow="hover" style="  background-color: #faa64b !important;color: #fff !important;">
                        <i class="el-icon-s-data" style="float: right;font-size: 32px;opacity: .9;"></i>
                        <div style="font-size:22PX">{{sxssl}}<span style="font-size: 12px;"> 个</span></div>
                        <div style="font-size:14px"> 实训室总数</div>
                    </el-card>
                </div>
            </el-col>
            <el-col :xs="6" :sm="6" class="mt10">
                <div>
                    <el-card shadow="hover" style="  background-color: #15c377 !important;color: #fff !important;">
                        <i class="el-icon-s-check" style="float: right;font-size: 32px;opacity: .9;"></i>
                        <div style="font-size:22PX">{{sbzsl}}<span style="font-size: 14px;"> 个</span></div>
                        <div style="font-size:14px"> 设备总数</div>
                    </el-card>
                </div>
            </el-col>
            <el-col :xs="6" :sm="6" class="mt10">
                <div>
                    <!--<el-card shadow="hover" style="  background-color: #f96197 !important;color: #fff !important;">
                        <i class="el-icon-edit-outline" style="float: right;font-size: 32px;opacity: .9;"></i>
                        <div style="font-size:22PX"> {{blz}}<span style="font-size: 14px;"> 个</span></div>
                        <div style="font-size:14px"> 办理中</div>
                    </el-card>-->
                </div>
            </el-col>
            <el-col :xs="6" :sm="6" class="mt10">
                <div>

                </div>
            </el-col>
        </el-row>
        <div class="tab-filter-type">

            <div class="oh mt20">
                <h5 class="pull-left tr">所属系部：</h5>
                <ul class="tab-type ft14">
                    <li v-for="item in xbdms" @click="selnd(item)"><span v-bind:class="{ active: item.isactive }" v-text="item.dname"></span></li>
                </ul>
            </div>
        </div>
        <!--<div class="tab-filter-type">

            <div class="input-group" style="width:520PX;margin-left:20PX;">
                <div class="input-group-btn">
                    <button type="button" style="min-width:120PX;height: 34px;" class="btn btn-info  dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{sear.colname}} <span class="caret"></span></button>
                    <ul class="dropdown-menu">
                        <li v-for="fi in tableop.collist" @click="sel(fi)"><a href="#" v-text="fi.colname"></a></li>
                    </ul>
                </div>
                <input type="text" class="form-control" style="height: 34px;" v-model="seastr" v-on:keyup.enter="seardata" placeholder="输入关键字,按Enter键搜索">
                <span class="input-group-btn" v-show="seastr">
                    <button class="btn btn-default" style="height: 34px;" @click="reset" type="button">重置</button>
                </span>
            </div>
        </div>-->
        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px">
            <base-table :pzoption="tableop">
            </base-table>
        </div>
        <!-- 表格 -->



    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {

                activeName: 'first',
                sbzsl: 0,
                sxssl: 0,
                xbdms: [],
                SelDSourceItem: {},
                alldata: [],
                tableop: {
                    title: "所有实训室",
                    issel: false,
                    iscz: true,
                    height: 700,
                    isxh: false,
                    dataset: [],
                    czltabledata: [
                        {
                            colname: "查看", bttype: "primary", isshow: true, mangefun: function (rowdata) {
                                window.open("/ViewV5/AppPage/QJJW/SXGL/SXSINDEX.html?piid=" + rowdata.intProcessStanceid + "&sxsid=" + rowdata.ID, "_blank");
                            },
                        },
                    ],
                    collist: [
                        { colid: "sxsname", colname: "实训室名称", isshow: true, istip: true },
                        { colid: "DName", colname: "所属系部", isshow: true, istip: true },
                        { colid: "jsdm", colname: "教室代码", isshow: true, istip: true },
                        { colid: "fjh", colname: "楼栋房间号", isshow: true, istip: true },
                        { colid: "sxxm", colname: "实训项目", isshow: true, istip: true },
                        {colid: "xianzhuang", colname: "现状", isshow: true, istip: true },
                        {colid: "szslb", colname: "实训室类别", isshow: true, istip: true },
                        { colid: "intProcessStanceid", colname: "流程ID", isshow: false, istip: true }
                    ]
                }
            }
        },
        methods: {
            selnd: function (item) {
                debugger;
                var pro = this;
                _.forEach(pro.xbdms, function (sel) {
                    sel.isactive = false;
                })
                item.isactive = true;
                if (item.dname == '全部') {
                    pro.tableop.dataset = pro.alldata;
                } else {
                    var dv = new DataSet.View().source(pro.alldata);
                    var redata = [];
                    dv.transform({
                        type: 'filter',
                        callback(row) { // 判断某一行是否保留，默认返回true
                            return (row["DName"] + "").indexOf(item.dname) > -1;
                        }
                    });
                    redata = dv.rows;
                    pro.tableop.dataset = redata;
                }

            },
            InitWigetData: function () {
                var pro = this;
                $.getJSON('/API/VIEWAPI.ashx?Action=SXGL_SXINDEX', {  }, function (resultData) {

                    if (resultData.Result.length > 0) {
                        pro.tableop.dataset = resultData.Result;
                        pro.alldata = resultData.Result;
                        pro.sbzsl = resultData.Result1;
                        pro.sxssl = resultData.Result.length;
                        var temp = [{ dname: "全部", isactive: true }];
                        for (var i = 0; i < resultData.Result2.length; i++) {
                            resultData.Result2[i].isactive = false;
                            temp.push(resultData.Result2[i]);
                        }
                        pro.xbdms = temp;

                    }
                })

            },
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>